package com.xwltz.common.phone.base;

import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

/**
 * @description IspEnum
 * @information on version 1.0 be created by @xwltz at 2021/11/08 15:10
 */

@SuppressWarnings("SpellCheckingInspection")
public enum IspEnum {
	CHINA_MOBILE(1, "中国移动"),
	CHINA_UNICOM(2, "中国联通"),
	CHINA_TELECOM(3, "中国电信"),
	CHINA_TELECOM_VIRTUAL(4, "中国电信虚拟运营商"),
	CHINA_UNICOM_VIRTUAL(5, "中国联通虚拟运营商"),
	CHINA_MOBILE_VIRTUAL(6, "中国移动虚拟运营商"),
	UNKNOWN(-1, "未知");

	/**
	 * 获取中文名
	 */
	@Getter
	private final Integer code;
	@Getter
	private final String describe;

	IspEnum(Integer code, String describe) {
		this.code = code;
		this.describe = describe;
	}

	public static Optional<IspEnum> of(int value) {
		return Arrays.stream(values()).filter(v -> v.code == value).findAny();
	}
}
